/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Engine2D.level.tile;

import Engine2D.graphics.GLSpriteSheet;
import Engine2D.level.Level;
import Engine2D.graphics.GLImage;

/**
 *
 * @author Garys
 */
public class TunnelTile extends Tile {

    /**
     * 
     * @param id
     * @param spriteSheet
     * @param sizeX
     * @param sizeY
     */
    public TunnelTile(int id, GLSpriteSheet spriteSheet, int sizeX, int sizeY) {
        super(id, sizeX, sizeY);
        this.image = spriteSheet;
    }

    /**
     * 
     * @param level
     * @param x
     * @param y
     */
    @Override
    public void render(Level level, int x, int y, int xt, int yt) {
        image.drawTile(x, y,288f, 480f);
    }
    
    /**
     * 
     * @param aThis
     * @param x
     * @param y
     * @return
     */
    @Override
    public int getLightRadius(Level aThis, int x, int y) {
        
        return 0;
    }
    
    public void tick(Level level, int xt, int yt) {
        if(level.getTile(xt+1, yt)==TileManager.water){
            level.setTile(xt, yt, TileManager.water, 0);
        }
        if(level.getTile(xt-1, yt)==TileManager.water){
            level.setTile(xt, yt, TileManager.water, 0);
        }
        if(level.getTile(xt, yt+1)==TileManager.water){
            level.setTile(xt, yt, TileManager.water, 0);
        }
        if(level.getTile(xt, yt-1)==TileManager.water){
            level.setTile(xt, yt, TileManager.water, 0);
        }
    }
    
    
}
